Skip to content

[pull] main from MetaMask:main#361

Merged
pull[bot] merged 11 commits into
Reality2byte:mainfrom
MetaMask:main
Nov 27, 2025
Merged

[pull] main from MetaMask:main#361
pull[bot] merged 11 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Nov 27, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

dan437 and others added 11 commits November 27, 2025 11:42
## **Description**
Removes nonce editing from Settings, have it always enabled unless it's
a smart transaction.

It also fixes an issue where we were only displaying 3 nonce digits when
editing, so I've adjusted width to show more digits.

## **Changelog**

CHANGELOG entry: Removes nonce editing from Settings, have it always
enabled unless it's a smart transaction.

## **Related issues**

Fixes: 
#22802
MetaMask/MetaMask-planning#6055

## **Manual testing steps**

STX on:
1. Have STX on in settings
2. Start a Send
3. Add recipient and amount
4. Click Advanced details
5. Nonce is not editable

STX off:
1. Have STX off in settings
2. Start a Send
3. Add recipient and amount
4. Click Advanced details
5. Nonce is editable

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Removes the “Customize transaction nonce” setting; nonce editing is
now enabled by default and only disabled when Smart Transactions are
enabled, with related UI, state, locales, and tests updated plus
improved nonce input width.
> 
> - **Settings**:
> - Remove `showCustomNonce` toggle (`actions`, `reducers`, selectors)
and Advanced Settings UI row; delete related locale strings.
> - **Confirmations/Transactions**:
> - Make nonce editable by default; disable when Smart Transactions are
enabled (`advanced-details-row`, legacy Approval/Approve/Send flows,
TransactionReview).
> - Always fetch network nonce on mount; remove `showCustomNonce`
plumbing and conditionals.
> - `buildTransactionParams` always sets `transactionParams.nonce`; drop
`showCustomNonce` arg.
> - **UI**:
> - Expose nonce edit row unconditionally in confirmation views; adjust
`CustomNonceModal` input to min/max width to show more digits.
> - **Tests**:
> - Update unit tests and snapshots; remove `selectShowCustomNonce`
usage; add `TransactionController.getNonceLock` mocks.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
05b35be. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
…23312)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

If nonEVM asset and recipient is selected and then if user picks EVM
token, then nonEVM recipient is persisting, or vice versa.

This PR aims to reset `recipient` when there is an existing asset
selected.


## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: Reset recipient when new asset is selected while
sending assets

## **Related issues**

Fixes: #22707

## **Manual testing steps**

1. Go send flow - pick an EVM token
2. Set amount - go next step
3. Set a recipient - go next step
4. Now go all way back to asset selection
5. Pick a nonEVM token - set amount - go next page
6. See recipient is empty

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**



https://github.com/user-attachments/assets/5b4dbee0-2096-4aeb-873a-4f491995fba7



### **After**


https://github.com/user-attachments/assets/70044ea3-c516-4862-b117-a40a1a8449e0

## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've completed the PR template to the best of my ability
- [X] I’ve included tests if applicable
- [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.





<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Resets the recipient (`updateTo('')`) when switching assets during the
send flow, updating token/NFT list logic and tests.
> 
> - **Send flow**:
> - `TokenList`
(`app/components/Views/confirmations/components/token-list/token-list.tsx`):
on token press, after `updateAsset`, if an existing asset is selected,
call `updateTo('')`; updated hook deps.
> - `NftList`
(`app/components/Views/confirmations/components/nft-list/nft-list.tsx`):
same recipient reset on NFT press; preserves navigation differences for
`ERC1155` vs others; updated hook deps.
> - **Tests**:
> - `token-list.test.tsx` and `nft-list.test.tsx`: mock `useSendContext`
to include `asset`/`updateTo`; add tests asserting `updateTo('')` is
called when an asset was already selected; keep existing
navigation/metrics assertions.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a76084b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

Implements dynamic fee calculation for HIP-3 Growth Mode markets using
HyperLiquid's official fee formula.

**Problem:** XYZ markets (xyz:TSLA, xyz:GOLD, etc.) are in "Growth Mode"
with 90% reduced fees, but our UI displayed 2x fees (0.090%) instead of
the actual 0.009%.

**Solution:** Fetch `deployerFeeScale` and `growthMode` from HyperLiquid
APIs and apply the official fee formula dynamically.

**Note:** The `@nktkas/hyperliquid` SDK types don't include `growthMode`
or `deployerFeeScale` fields yet. We've added `ExtendedAssetMeta` and
`ExtendedPerpDex` types locally until the SDK is updated.

## **Changelog**

CHANGELOG entry: Fixed Perps fee display for HIP-3 Growth Mode markets
(90% fee reduction now shown correctly)

## **Related issues**

Fixes: TAT-2110

## **Manual testing steps**

```gherkin
Feature: Dynamic fee display for Growth Mode markets

  Scenario: User views fees for Growth Mode HIP-3 market
    Given user is on Perps trading screen
    And user selects xyz:TSLA (Growth Mode enabled)

    When user views fee breakdown
    Then taker fee shows ~0.009% (not 0.090%)
    And fee matches HyperLiquid web app

  Scenario: User views fees for regular market
    Given user selects BTC or ETH

    When user views fee breakdown
    Then taker fee shows ~0.045%
    And no Growth Mode discount applied
```

## **Screenshots/Recordings**

### **Before**
- xyz:TSLA showed 0.090% taker fee (hardcoded 2x multiplier)
<img width="412" height="870" alt="image"
src="https://github.com/user-attachments/assets/426eca38-57e2-469f-b12e-2cf7aa5c13a6"
/>

### **After**
- xyz:TSLA shows ~0.009% taker fee (dynamic: 2x HIP-3 × 0.1 Growth Mode)
<img width="425" height="892" alt="image"
src="https://github.com/user-attachments/assets/1adb2103-400b-451a-ba0f-ea2481f44fe3"
/>

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Implements dynamic HIP‑3 perp fee calculation (using deployerFeeScale
and Growth Mode) with caching, updated types, and docs.
> 
> - **Provider (HyperLiquidProvider)**:
> - Add `calculateHip3FeeMultiplier()` and TTL-cached
`getCachedPerpDexs()`; fetch `deployerFeeScale` and asset `growthMode`
to compute HIP‑3 multipliers.
> - Apply dynamic HIP‑3 multiplier in `calculateFees()` for both base
and user-specific rates; enhanced logging; clear `perpDexsCache` on
disconnect.
> - **Config**:
> - Extend `HIP3_FEE_CONFIG` with `GROWTH_MODE_SCALE`,
`DEFAULT_DEPLOYER_FEE_SCALE`, `PERP_DEXS_CACHE_TTL_MS`; mark
`FEE_MULTIPLIER` as deprecated.
> - **Types**:
> - Add `ExtendedAssetMeta` (includes `growthMode`) and
`ExtendedPerpDex` (includes `deployerFeeScale`).
> - **Docs**:
> - Update `docs/perps/hyperliquid/fees.md` with official fee formula
and Growth Mode behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f6fefdb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
Temporarily disables `add-popular-networks.spec.ts` to unblock. Will fix
on a follow up pr.
The scroll is grabbing on a specific place that makes the app drawer to
open on Android.

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Skips the "Add all popular networks" E2E test by replacing conditional
`itif` with `it.skip` in
`e2e/specs/networks/add-popular-networks.spec.ts`.
> 
> - **E2E tests**
>   - In `e2e/specs/networks/add-popular-networks.spec.ts`:
> - Replace conditional `itif(isRemoveGlobalNetworkSelectorEnabled)`
with `it.skip` for the "Add all popular networks" test in the
GNS-enabled suite, disabling it unconditionally.
>     - No changes to the GNS-disabled suite.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0290c23. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…23216)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
Adds ability to restrict `pay-with-modal` tokens. This is used during
the mUSD conversion flow to restrict payment tokens to only the desired
stablecoins (e.g. USDC, USDT, DAI).
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: restrict allowed payment tokens in the mUSD conversion
flow

## **Related issues**

Fixes: [MUSD-108: Bring back mUSD confirmations
enhancements](https://consensyssoftware.atlassian.net/browse/MUSD-108)

## **Manual testing steps**

```gherkin
Feature: mUSD Conversion Flow with Restricted Payment Tokens

  Scenario: user wants to convert their USDC to mUSD
    Given user is on mUSD confirmation screen

    When user clicks "pay with" row
    Then "pay with" modal only displays allowed payment tokens (e.g. USDC, USDT, DAI)
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
All non-zero balance tokens are visible in the pay-with modal unless
explicitly marked as required.
### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/0841366f-f463-4442-accc-2081594024a4

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Restricts Pay With modal tokens to an allowlisted set of stablecoins
during mUSD conversion, refactors the flow to use `outputChainId` with
mUSD address mapping, and updates UI and tests accordingly.
> 
> - **Earn (mUSD)**:
> - Replace `outputToken` config with `outputChainId`; resolve mUSD
address via `MUSD_TOKEN_ADDRESS_BY_CHAIN`.
> - Add `MUSD_CONVERSION_STABLECOINS_BY_CHAIN_ID` and derived
`CONVERTIBLE_STABLECOINS_BY_CHAIN`.
> - **Hooks/Utils**:
> - New `useMusdConversionTokens` to compute/validate allowed payment
tokens and identify convertible tokens.
> - Enhance utils with `convertSymbolAllowlistToAddresses`,
`areValidAllowedPaymentTokens`, and updated
`isMusdConversionPaymentToken` signature.
> - `useMusdConversion` navigates with `outputChainId`, builds tx to
chain-specific mUSD, and sets `TransactionType.musdConversion`.
> - **Feature Flags/Selectors**:
> - `selectMusdConversionPaymentTokensAllowlist` supports remote/local
symbol allowlists with validation and fallbacks.
> - **UI**:
> - `StakeButton` and token list items use `useMusdConversionTokens` to
show "Convert" CTA for eligible stablecoins.
>   - `MusdConversionInfo` derives mUSD token by chain and auto-adds it.
> - `PayWithModal` filters tokens by allowlist only for `musdConversion`
transactions.
> - **Tests**:
> - Comprehensive new/updated tests across hooks, selectors, modal, and
components for filtering, navigation, and error paths.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7291f80. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

Fixes balance display on Perps home screen showing incorrect values.
Total Balance and Available Balance were displaying the same value even
with open positions.

**Root cause**: `totalBalance` was using
`crossMarginSummary.accountValue` which only includes cross-margin
funds, but the app uses isolated margin positions.

**Fix**: Changed `totalBalance` to use `marginSummary.accountValue`
which includes all margin (isolated positions).

## **Changelog**

CHANGELOG entry: Fixed Perps home screen showing same value for Total
Balance and Available Balance

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1938

## **Manual testing steps**

```gherkin
Feature: Perps balance display

  Scenario: User views balances with open positions
    Given the user has open isolated margin positions on HyperLiquid
    And the user navigates to the Perps home screen

    When the balances are displayed
    Then Total Balance should show the full account value (e.g., $11.31)
    And Available Balance should show funds available for new trades (e.g., $4.21)
    And these values should match what HyperLiquid shows
```

## **Screenshots/Recordings**

### **Before**

Total Balance: $4.21
Available Balance: <$0.01
<img width="395" height="482" alt="image"
src="https://github.com/user-attachments/assets/5a8936df-92cb-4b6c-a7ce-a535f33eb532"
/>

### **After**

Total Balance: $11.31
Available Balance: $4.21
<img width="407" height="356" alt="image"
src="https://github.com/user-attachments/assets/2a894397-f971-4565-b381-cbd0a0919d78"
/>

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Use `marginSummary.accountValue` for total balance (includes isolated
margin) and update related tests/expectations.
> 
> - **Perps Adapter
(`app/components/UI/Perps/utils/hyperLiquidAdapter.ts`)**:
> - Use `perpsState.marginSummary.accountValue` (not
`crossMarginSummary.accountValue`) when computing perps balance in
`adaptAccountStateFromSDK`.
>   - Keep total balance as Spot + Perps; minor comment cleanup.
> - **Tests**:
> - Update expected `totalBalance` values to reflect isolated margin
inclusion:
> - `HyperLiquidProvider.test.ts`: `20500` (10000 spot + 10500 perps).
> - `hyperLiquidAdapter.test.ts`: expectations unchanged numerically but
align with new source and remove extraneous inline comments.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1e809a5. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

Implements a stop loss prompt banner that encourages users to set a stop
loss on losing positions, helping reduce liquidation risk and improve
user-perceived safety.

**Features:**
- Shows "Protect against further losses" banner when position ROE <=
-20% for 60s without existing stop loss
- Shows "Add margin" variant when position is within 3% of liquidation
- One-tap toggle to set stop loss at suggested price (-50% ROE)
- Fade-out animation on successful stop loss placement
- Suppresses for cross-margin positions or positions with existing stop
loss

## **Changelog**

CHANGELOG entry: Added stop loss prompt banner to help users protect
losing positions

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1693

## **Manual testing steps**

```gherkin
Feature: Stop Loss Prompt Banner

  Scenario: User sees stop loss prompt on losing position
    Given user has an open position with ROE <= -20% for 60+ seconds
    And position has no existing stop loss

    When user views the market details screen
    Then user sees "Protect against further losses" banner with toggle

  Scenario: User sets stop loss via toggle
    Given user sees the stop loss prompt banner

    When user taps the toggle
    Then stop loss is set at suggested price
    And banner fades out
    And stop loss appears in auto-close section

  Scenario: User sees add margin prompt near liquidation
    Given user has a position within 3% of liquidation price

    When user views the market details screen
    Then user sees "Add margin" banner variant
```

## **Screenshots/Recordings**

### **Before**

N/A - New feature

### **After**

<!-- Add screenshots of both banner variants -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds a Stop Loss/Add Margin prompt banner driven by a new hook,
integrates it into `PerpsMarketDetailsView`, and updates tests,
selectors, config, and locales.
> 
> - **Perps Market Details UI**:
> - Integrates new non-dismissible `PerpsStopLossPromptBanner` into
`PerpsMarketDetailsView`, with handlers to add margin (`navigate to
> `Routes.PERPS.ADJUST_MARGIN`) and one-tap set stop loss via
`handleUpdateTPSL`, success fade-out, and event tracking.
> - Wires `useStopLossPrompt` to determine when to show banner, variant
(`add_margin` vs `stop_loss`), liquidation distance, and suggested SL
price/percent.
> - **New Components & Hook**:
> - `components/PerpsStopLossPromptBanner/` (TSX, styles, types) with
two variants, toggle/button, loading state, and fade-out animation.
> - `hooks/useStopLossPrompt` computes liquidation proximity, ROE
debounce, suggested SL price at configured ROE, and suppression rules
(cross margin, existing SL), plus dev override.
> - **Config & i18n**:
> - Adds `STOP_LOSS_PROMPT_CONFIG` (liquidation threshold, ROE
threshold/debounce, suggested SL ROE) to `perpsConfig`.
> - Adds localized strings under `perps.stop_loss_prompt` in `en.json`.
> - **Testing & Selectors**:
> - Unit tests for `PerpsStopLossPromptBanner` and `useStopLossPrompt`
covering variants, loading/success, formatting, debounce, edge cases.
> - E2E selectors for stop-loss prompt banner
(`PerpsStopLossPromptSelectorsIDs`) and market details banner testID.
> - **Analytics/Tracking**:
> - Tracks UI interactions for add-margin and set-stop-loss actions with
asset and SL price properties.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f30098a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Nick Gambino <35090461+gambinish@users.noreply.github.com>
Co-authored-by: Salim TOUBAL <salim.toubal@outlook.com>
Co-authored-by: George Gkasdrogkas <georgegkas@gmail.com>
Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
Co-authored-by: MetaMask Bot <37885440+metamaskbot@users.noreply.github.com>
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Michal Szorad <michal.szorad@consensys.net>
Co-authored-by: Patryk Łucka <5708018+PatrykLucka@users.noreply.github.com>
Co-authored-by: VGR <VanGulckRik@gmail.com>
Co-authored-by: sahar-fehri <sahar.fehri@consensys.net>
Co-authored-by: OGPoyraz <omergoktugpoyraz@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: Aslau Mario-Daniel <marioaslau@gmail.com>
Co-authored-by: Nico MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Corey Janssen <107953793+coreyjanssen@users.noreply.github.com>
Co-authored-by: Bernardo Garces Chapero <bernardo.chapero@consensys.net>
Co-authored-by: António Regadas <antonio.regadas@consensys.net>
Co-authored-by: Alejandro Garcia <alejandro.garcia@consensys.net>
Co-authored-by: Nicholas Smith <nick.smith@consensys.net>
Co-authored-by: Juanmi <95381763+juanmigdr@users.noreply.github.com>
Co-authored-by: Andre Pimenta <andrepimenta7@gmail.com>
Co-authored-by: Vince Howard <vincenguyenhoward@gmail.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Brian August Nguyen <brianacnguyen@gmail.com>
Co-authored-by: Kylan Hurt <6249205+smilingkylan@users.noreply.github.com>
## **Description**

The icon being used for each recipient addresses was not re-using their
account group icons (we use the EVM address of a multichain account
group as the seed of account's icons).

This PR fixes this while keeping the original `recipient.address` as a
fallback (which should never happen anyway).

## **Changelog**

CHANGELOG entry: Fix account's icons for send flows

## **Related issues**

Fixes:
- #22806

## **Manual testing steps**

```gherkin
Feature: Send non-EVM token

  Scenario: user starts a send flow for Solana
    Given the user has funds

    When user selects the recipient address
    Then he should see the same icons than the one used for the account list
```

## **Screenshots/Recordings**

### **Before**


https://github.com/user-attachments/assets/100969c2-15e9-49c4-a2f3-cd24aac8e839

<img width="382" height="192" alt="Screenshot 2025-11-27 at 13 28 36"
src="https://github.com/user-attachments/assets/53225dd9-8e47-4788-850e-09579c312e96"
/>
<img width="377" height="250" alt="Screenshot 2025-11-27 at 13 28 22"
src="https://github.com/user-attachments/assets/07e5b9aa-4a1c-44ff-ac6a-402a0712bd1a"
/>

### **After**


https://github.com/user-attachments/assets/221c05e4-b040-4583-b81f-de674f716db1

<img width="385" height="220" alt="Screenshot 2025-11-27 at 13 29 52"
src="https://github.com/user-attachments/assets/02b959f4-7334-454f-8939-931054f68bf3"
/>
<img width="383" height="194" alt="Screenshot 2025-11-27 at 13 29 36"
src="https://github.com/user-attachments/assets/a1eb109d-e74a-4de2-9844-ec5675e565c3"
/>

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Recipient avatars now derive from the account group’s icon seed (with
address fallback), and useAccounts returns accountGroupId; tests updated
accordingly.
> 
> - **UI (recipient)**:
> - Avatar `accountAddress` now sourced from account group icon seed via
`selectIconSeedAddressByAccountGroupId`, with fallback to
`recipient.address`.
> - `RecipientType` extended with `accountGroupId`; Redux selector added
to compute avatar seed.
> - **Hooks**:
> - `useAccounts` now includes `accountGroupId` in returned recipient
objects.
> - **Tests**:
> - Updated `useAccounts.test.ts` expectations to include
`accountGroupId` across EVM, Solana, Bitcoin, and Tron cases.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bcc1017. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description**

Add USDH collateral support for HIP-3 DEXs on HyperLiquid.

Some HIP-3 DEXs (like `vntl`, `flx`) use USDH as collateral instead of
USDC. This PR automatically detects USDH DEXs and acquires USDH
collateral by transferring USDC to spot and swapping to USDH before
placing orders.

HyperLiquid spot has a $10 minimum order value, so first-time USDH DEX
trades require $10 USDC available.

## **Changelog**

CHANGELOG entry: Added support for trading on USDH-collateralized HIP-3
DEXs with automatic USDC→USDH conversion

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: USDH DEX Trading

  Scenario: User places order on USDH DEX with sufficient balance
    Given user has $10+ USDC in main perps balance
    And user has 0 USDH in spot

    When user places a $10 order on vntl:SPACEX at 3x leverage
    Then order is placed successfully

  Scenario: User places order on USDH DEX with insufficient balance
    Given user has < $10 USDC available
    And user has 0 USDH in spot

    When user places a $10 order on vntl:SPACEX
    Then error message explains $10 minimum requirement
```

## **Screenshots/Recordings**

### **Before**

### **After**


https://github.com/user-attachments/assets/240055b3-62ae-439b-864e-8a186a8debf5


## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds automatic USDH collateral handling for HIP-3 DEXs by detecting
USDH markets and acquiring USDH via USDC→USDH spot swaps before placing
orders.
> 
> - **Perps/HyperLiquid**:
>   - **USDH Collateral Support**:
> - Add `USDH_CONFIG` (token name, swap slippage bps) in
`constants/hyperLiquidConfig.ts`.
> - Detect USDH-collateralized DEXs via `isUsdhCollateralDex()` using
`meta()` and `spotMeta()`.
> - Retrieve spot balances (`getSpotUsdhBalance()`,
`getSpotUsdcBalance()`), transfer USDC to spot (`transferUsdcToSpot()`),
and swap USDC→USDH (`swapUsdcToUsdh()`) with slippage and $10 minimum
order handling.
> - Ensure USDH collateral before HIP-3 orders with
`ensureUsdhCollateralForOrder()`; integrate into `handleHip3PreOrder()`
so USDH DEXs pull from spot automatically.
> - **Misc**: Additional logging/error handling and minor integrations
around order flow without altering non-USDH paths.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
762ae92. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Co-authored-by: Vince Howard <vincenguyenhoward@gmail.com>
Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
Co-authored-by: ieow <4881057+ieow@users.noreply.github.com>
Co-authored-by: Charly Chevalier <charlyy.chevalier@gmail.com>
Co-authored-by: George Gkasdrogkas <georgegkas@gmail.com>
Co-authored-by: Juanmi <95381763+juanmigdr@users.noreply.github.com>
Co-authored-by: Patryk Łucka <5708018+PatrykLucka@users.noreply.github.com>
Co-authored-by: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com>
Co-authored-by: sahar-fehri <sahar.fehri@consensys.net>
Co-authored-by: Fred <frederic.heng@consensys.net>
Co-authored-by: imblue <106779544+imblue-dabadee@users.noreply.github.com>
Co-authored-by: sethkfman <setk.kaufman@consensys.net>
Co-authored-by: Alejandro Garcia Anglada <aganglada@gmail.com>
Co-authored-by: Kevin Bluer <kevin@bluer.com>
Co-authored-by: Nick Gambino <35090461+gambinish@users.noreply.github.com>
Co-authored-by: Salim TOUBAL <salim.toubal@outlook.com>
Co-authored-by: MetaMask Bot <37885440+metamaskbot@users.noreply.github.com>
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Michal Szorad <michal.szorad@consensys.net>
Co-authored-by: VGR <VanGulckRik@gmail.com>
Co-authored-by: OGPoyraz <omergoktugpoyraz@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: Aslau Mario-Daniel <marioaslau@gmail.com>
Co-authored-by: Nico MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Corey Janssen <107953793+coreyjanssen@users.noreply.github.com>
Co-authored-by: Bernardo Garces Chapero <bernardo.chapero@consensys.net>
Co-authored-by: António Regadas <antonio.regadas@consensys.net>
Co-authored-by: Alejandro Garcia <alejandro.garcia@consensys.net>
Co-authored-by: Nicholas Smith <nick.smith@consensys.net>
Co-authored-by: Andre Pimenta <andrepimenta7@gmail.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Brian August Nguyen <brianacnguyen@gmail.com>
Co-authored-by: Kylan Hurt <6249205+smilingkylan@users.noreply.github.com>
Co-authored-by: Amitabh Aggarwal <aggarwal.amitabh@gmail.com>
Co-authored-by: SteP-n-s <stylianos.panagakos@consensys.net>
Co-authored-by: sophieqgu <37032128+sophieqgu@users.noreply.github.com>
Co-authored-by: Ramon AC <36987446+racitores@users.noreply.github.com>
Co-authored-by: Wei Sun <wei.sun@consensys.net>
Co-authored-by: AugmentedMode <31675118+AugmentedMode@users.noreply.github.com>
Co-authored-by: Pavel Dvorkin <pavel.dvorkin@consensys.net>
Co-authored-by: Caainã Jeronimo <caainaje@gmail.com>
Co-authored-by: sethkfman <10342624+sethkfman@users.noreply.github.com>
Co-authored-by: Luis Taniça <matallui@gmail.com>
Co-authored-by: Florin Dzeladini <florin.dzeladini@consensys.net>
Co-authored-by: Julien Fontanel <julien.fontanel@consensys.net>
Co-authored-by: maxime-oe <maxime.ouairy-ext@consensys.net>
Co-authored-by: Daniel <80175477+dan437@users.noreply.github.com>
## **Description**

Implements the Order Book view for Perps trading, allowing users to view
real-time bid/ask depth data with a depth chart visualization.

**Features:**
- Real-time L2 order book data via WebSocket subscription
- Depth chart showing cumulative bid/ask volumes
- Configurable price aggregation (nSigFigs: 2-5) via dropdown
- Unit toggle (base currency / USD) in header
- Long/Short action buttons

## **Changelog**

CHANGELOG entry: Added Order Book view for Perps trading with depth
chart and configurable price aggregation

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1236

## **Manual testing steps**

```gherkin
Feature: Perps Order Book

  Scenario: User views order book for an asset
    Given user is on the Market Details screen for BTC

    When user taps "Order Book" button
    Then user sees the Order Book screen with depth chart and bid/ask table

  Scenario: User changes price aggregation
    Given user is on the Order Book screen

    When user taps the depth band dropdown (e.g., "5")
    And user selects a different value (e.g., "3")
    Then the order book updates with new price grouping

  Scenario: User toggles unit display
    Given user is on the Order Book screen

    When user taps "USD" toggle in header
    Then totals display in USD
    When user taps "BTC" toggle
    Then totals display in base currency
```

## **Screenshots/Recordings**

### **Before**

N/A - New feature

### **After**

<!-- Add screenshots of Order Book view -->


https://github.com/user-attachments/assets/c9650002-0bef-4c3f-be82-e54e61e7aa93


## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces a full Perps Order Book screen with live L2 data, depth
chart/table, grouping and unit toggles, navigation, metrics, and
comprehensive tests.
> 
> - **UI**:
> - **Order Book View**: New `PerpsOrderBookView` with unit toggle,
price-grouping dropdown, Long/Short actions, and navigation from
`PerpsMarketStatisticsCard`.
> - **Components**: `PerpsOrderBookDepthChart` and `PerpsOrderBookTable`
with styles and E2E selectors.
> - **Navigation**: Adds route `Routes.PERPS.ORDER_BOOK` and screen
wiring.
> - **Data/Logic**:
> - **Live Order Book**: New hook `usePerpsLiveOrderBook` (throttled)
and grouping utils (`orderBookGrouping`) for client-side aggregation.
> - **Controllers/Providers**: Adds `subscribeToOrderBook` across
controller, HyperLiquid provider, and subscription service; new types
`OrderBookData`/`OrderBookLevel`.
> - **Analytics/Tracing/i18n**:
> - Adds `ORDER_BOOK` screen/event, updates `PERPS_SCREEN_VIEWED`, new
trace `PerpsOrderBookView`, E2E selectors, and i18n strings.
> - **Other**:
> - Order nav param renamed from `size` to `amount` in flows/tests;
minor test updates (market mock shape).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e0f9cbd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Nick Gambino <35090461+gambinish@users.noreply.github.com>
Co-authored-by: Salim TOUBAL <salim.toubal@outlook.com>
Co-authored-by: George Gkasdrogkas <georgegkas@gmail.com>
Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
Co-authored-by: MetaMask Bot <37885440+metamaskbot@users.noreply.github.com>
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Michal Szorad <michal.szorad@consensys.net>
Co-authored-by: Patryk Łucka <5708018+PatrykLucka@users.noreply.github.com>
Co-authored-by: VGR <VanGulckRik@gmail.com>
Co-authored-by: sahar-fehri <sahar.fehri@consensys.net>
Co-authored-by: OGPoyraz <omergoktugpoyraz@gmail.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@gmail.com>
Co-authored-by: Aslau Mario-Daniel <marioaslau@gmail.com>
Co-authored-by: Nico MASSART <NicolasMassart@users.noreply.github.com>
Co-authored-by: Corey Janssen <107953793+coreyjanssen@users.noreply.github.com>
Co-authored-by: Bernardo Garces Chapero <bernardo.chapero@consensys.net>
Co-authored-by: António Regadas <antonio.regadas@consensys.net>
Co-authored-by: Alejandro Garcia <alejandro.garcia@consensys.net>
Co-authored-by: Nicholas Smith <nick.smith@consensys.net>
Co-authored-by: Juanmi <95381763+juanmigdr@users.noreply.github.com>
Co-authored-by: Andre Pimenta <andrepimenta7@gmail.com>
Co-authored-by: Vince Howard <vincenguyenhoward@gmail.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: Brian August Nguyen <brianacnguyen@gmail.com>
Co-authored-by: Kylan Hurt <6249205+smilingkylan@users.noreply.github.com>
Co-authored-by: Nicholas Gambino <nicholas.gambino@consensys.net>
Co-authored-by: Claude <noreply@anthropic.com>
)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**
Adds payment token pre-selection support in
`useAutomaticTransactionPayToken` hook. mUSD conversion flow uses this
to preselect based on the asset CTA clicked.
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: added payment token preselection in mUSD conversion
flow

## **Related issues**

Fixes: [MUSD-108: Bring back mUSD confirmations
enhancements](https://consensyssoftware.atlassian.net/browse/MUSD-108)

## **Manual testing steps**

```gherkin
Feature: mUSD Conversion

  Scenario: Payment Token Preselection
    Given user has non-zero asset balance

    When user user clicks "Convert" CTA next to supported token (e.g. USDC)
    Then user is redirected to the mUSD conversion confirmation page with the correct asset preselected as the payment token.
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
Asset is not preselected
### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/fc056a92-2f26-425f-84aa-5e1623a37b88

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds preferred payment token selection to
`useAutomaticTransactionPayToken` and wires mUSD conversion to preselect
it; updates tests and docs.
> 
> - **Payments/Confirmations**:
>   - **`useAutomaticTransactionPayToken`**:
>     - Adds `SetPayTokenRequest` and optional `preferredToken` param.
> - Selection prefers `preferredToken` when available; ignores it for
hardware wallets; otherwise falls back to first available or target
required token.
> - **Tests**: Extend to cover preferred token availability, hardware
wallet fallback, empty tokens, and non-matching cases.
> - **mUSD Conversion Flow**:
> - **`musd-conversion-info` → `CustomAmountInfo`**: Pass
`preferredPaymentToken` param down as `preferredToken` to the hook.
> - **`useMusdConversion`**: JSDoc example updated; clarifies async gas
estimation; navigates with `preferredPaymentToken` and `outputChainId`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0c3c367. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Nov 27, 2025
@pull pull Bot added the ⤵️ pull label Nov 27, 2025
@pull pull Bot merged commit 4e88440 into Reality2byte:main Nov 27, 2025
3 of 37 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants